#include "key.h"
#include "delay.h"
#include <REGX52.H>

sbit KEY0 = P1^5;
sbit KEY1 = P1^6;
sbit KEY2 = P1^7;

char Key_Status()
{
	if (KEY0 == 0)
	{
		delay_10us(500);
		if (KEY0 == 0)
		{
			return 0;
		}
	}
	if (KEY1 == 0)
	{
		delay_10us(500);
		if (KEY1 == 0)
		{
			return 1;
		}
	}
	if (KEY2 == 0)
	{
		delay_10us(500);
		if (KEY2 == 0)
		{
			return 2;
		}
	}
	return -1;
}